package com.chuanjiabao.wisdom.util.dialog;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.view.LayoutInflater;
import android.view.View;

import com.chuanjiabao.wisdom.R;
import com.chuanjiabao.wisdom.databinding.DialogDeleteHintBinding;
import com.chuanjiabao.wisdom.listener.OnBHClickListener;
import com.flyco.animation.SlideEnter.SlideBottomEnter;
import com.flyco.animation.SlideExit.SlideBottomExit;
import com.flyco.dialog.widget.base.BottomBaseDialog;

public class HintDeleteDialog extends BottomBaseDialog {

    private DialogDeleteHintBinding binding;
    private OnBHClickListener onBHClickListener;

    public HintDeleteDialog(Context context) {
        super(context);

        binding = DataBindingUtil.inflate(
                LayoutInflater.from(context),
                R.layout.dialog_delete_hint,
                null,
                false
        );
        binding.setDialog(this);
    }

    @Override
    public View onCreateView() {
        return binding.getRoot();
    }

    @Override
    public void setUiBeforShow() {
        showAnim(new SlideBottomEnter());
        dismissAnim(new SlideBottomExit());
    }

    public HintDeleteDialog setTitle(String title) {
        binding.tvModuletitle.setText(title);
        return this;
    }

    public HintDeleteDialog setContent(String content) {
        binding.tvModuleHint.setText(content);
        return this;
    }

    public HintDeleteDialog setYes(String hint) {
        binding.tvModuleSure.setText(hint);
        return this;
    }

    public HintDeleteDialog setNo(String hint) {
        binding.tvModuleClose.setText(hint);
        return this;
    }

    public HintDeleteDialog dismissNotAnim() {
        dismissAnim(null);
        return this;
    }

    public HintDeleteDialog setOnBHClickListener(OnBHClickListener onBHClickListener) {
        this.onBHClickListener = onBHClickListener;
        return this;
    }

    public void noPoint(View view){
        if (onBHClickListener != null) {
            onBHClickListener.onCloseClick();
        }
        dismiss();
    }

    public void okPoint(View view){
        if (onBHClickListener != null) {
            onBHClickListener.onConfirmClick();
        }
        dismiss();
    }

}


